package thread;

public class ThreadInfoDemo {
    public static void main(String[] args) {
        //Thread t = new Thread ("nice"){//Thread实例化可以自行指定名字}
        Thread t =new MyThread1(){//若不指定名字则使用系统分配的名字
            @Override
            public void run() {
                String name =this.getName();
                System.out.println(name);

                long id =this.getId();//id同时具有两个要求,1非空2唯一 id通常由系统分配
                System.out.println(id);

                int priority =this.getPriority();//优先级
                System.out.println(priority);

                boolean isInterrupted = this.isInterrupted();
                boolean isDaemon =this.isDaemon();
                boolean isAlive = this.isAlive();
                System.out.println("是否被中断"+isInterrupted);
                System.out.println("是否守护线程"+isDaemon);
                System.out.println("是否活着"+isAlive);
            }
        };
        t.start();
    }
}
